FROM ubuntu:bionic AS backend

RUN apt-get update
RUN apt-get install -y build-essential ca-certificates cabextract libc6-dev-i386 git-core curl

WORKDIR /opt/loadlibrary
RUN git clone https://github.com/taviso/loadlibrary.git /opt/loadlibrary
RUN make

WORKDIR /opt/loadlibrary/engine
RUN curl -L "https://go.microsoft.com/fwlink/?LinkID=121721&arch=x86" --output mpan-fe.exe
RUN cabextract mpan-fe.exe && rm mpan-fe.exe

FROM mindcollapse/malware-multi-scan-scanner:latest

RUN apt-get update && apt-get install -y libc6-i386

COPY --from=backend /opt/loadlibrary/engine /opt/engine
COPY --from=backend /opt/loadlibrary/mpclient /opt/mpclient

ENV BackendType=Defender